import os
from pathlib import Path
from .pyhgvs.utils import read_transcripts
from .utils import read_pathogenic_site, read_pvs1_levels, create_bed_dict, read_gene_alias

DataPath = Path(os.path.realpath(__file__)).parent/'data'

pvs1_levels = read_pvs1_levels(DataPath/'PVS1.level')
gene_alias = read_gene_alias(DataPath/'hgnc.symbol.previous.tsv')

gene_trans = {}
trans_gene = {}
with open(DataPath/'clinvar_trans_stats.tsv') as f:
    for line in f:
        record = line.strip().split("\t")
        gene, trans = record[0], record[1]
        gene_trans[gene] = trans
        trans_gene[trans] = gene

transcripts_hg19 = read_transcripts(open(DataPath/'ncbiRefSeq_hg19.gpe'))
transcripts_hg38 = read_transcripts(open(DataPath/'ncbiRefSeq_hg38.gpe'))

domain_hg19 = create_bed_dict(DataPath/'functional_domains_hg19.bed')
domain_hg38 = create_bed_dict(DataPath/'functional_domains_hg38.bed')

hotspot_hg19 = create_bed_dict(DataPath/'mutational_hotspots_hg19.bed')
hotspot_hg38 = create_bed_dict(DataPath/'mutational_hotspots_hg38.bed')

curated_region_hg19 = create_bed_dict(DataPath/'expert_curated_domains_hg19.bed')
curated_region_hg38 = create_bed_dict(DataPath/'expert_curated_domains_hg38.bed')

exon_lof_popmax_hg19 = create_bed_dict(DataPath/'exon_lof_popmax_hg19.bed')
exon_lof_popmax_hg38 = create_bed_dict(DataPath/'exon_lof_popmax_hg38.bed')

pathogenic_hg19 = read_pathogenic_site(DataPath/'clinvar_pathogenic_GRCh37.vcf')
pathogenic_hg38 = read_pathogenic_site(DataPath/'clinvar_pathogenic_GRCh38.vcf')
